#include "RenderGraphPass.h"
namespace Alice
{
    RDGPass::RDGPass(RDGParameterStruct InParameterStruct,ERDGPassFlags InFlags)
        :mParameterStruct(InParameterStruct)
        ,mPipeline(EnumHasAnyFlags(InFlags, ERDGPassFlags::AsyncCompute) ? ERHIPipeline::AsyncCompute : ERHIPipeline::Graphics)
    {
        
    }

    CGICommandList* RDGDispatchPassBuilder::CreateCommandList()
    {
        CGICommandList*cgiCommandList=new CGICommandList();
        cgiCommandList->SwitchPipeline(mPass->GetPipeline());

        // When parallel executing, the pass commands are embedded directly into the first command list.
        //if (mPass->bParallelExecute && mPass->mCommandLists.IsEmpty())
        //{
        //    FRDGBuilder::PushPreScopes(*RHICmdList, Pass);
        //    FRDGBuilder::ExecutePassPrologue(*RHICmdList, Pass);
        //}

        if (mRenderPassInfo)
        {
            cgiCommandList->BeginRenderPass(mRenderPassInfo, TEXT("DispatchPass"));
        }

        //cgiCommandList->SetStaticUniformBuffers(StaticUniformBuffers);

        mPass->mCommandLists.push_back(cgiCommandList);
        return cgiCommandList;
    }
    void RDGDispatchPassBuilder::Finish()
    {
        
    }

}